Imports System
Imports System.Drawing

Module ColoresVS

   Public Function VSNetBackgroundColor()

      Return CalcularColor(SystemColors.Window, SystemColors.Control, 220)

   End Function

   Public Function VSNetSelectionColor()

      Return CalcularColor(SystemColors.Highlight, SystemColors.Window, 70)

   End Function

   Public Function VSNetStripeColor()

      Return CalcularColor(SystemColors.Control, VSNetBackgroundColor, 195)

   End Function

   Public Function VSNetPressedColor()

      Return CalcularColor(SystemColors.Highlight, VSNetSelectionColor, 70)

   End Function

   Public Function VSNetToggleColor()

      Return CalcularColor(SystemColors.Highlight, SystemColors.Window, 30)

   End Function

   Private Function CalcularColor(ByVal front As Color, ByVal back As Color, ByVal alpha As Integer) As Color
      Dim frontColor As Color = Color.FromArgb(255, front)
      Dim backColor As Color = Color.FromArgb(255, back)

      Dim frontRed As Single = frontColor.R
      Dim frontGreen As Single = frontColor.G
      Dim frontBlue As Single = frontColor.B
      Dim backRed As Single = backColor.R
      Dim backGreen As Single = backColor.G
      Dim backBlue As Single = backColor.B

      Dim fRed As Byte = frontRed * alpha / 255 + backRed * (CSng(255 - alpha) / 255)
      Dim newRed As Byte = CByte(fRed)
      Dim fGreen As Single = frontGreen * alpha / 255 + backGreen * (CSng(255 - alpha) / 255)
      Dim newGreen As Byte = CByte(fGreen)
      Dim fBlue As Single = frontBlue * alpha / 255 + backBlue * (CSng(255 - alpha) / 255)
      Dim newBlue As Byte = CByte(fBlue)

      Return Color.FromArgb(255, newRed, newGreen, newBlue)

   End Function

End Module
